import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:wanke/about_page.dart';
import 'package:wanke/feedback_page.dart';
import 'package:wanke/safe_page.dart';
import 'function.dart';

class SettingPage extends StatefulWidget {
  SettingPage(this.mainColor);
  final mainColor;
  @override
  _SettingPageState createState() => new _SettingPageState();
}

class _SettingPageState extends State<SettingPage> {
  String uid = "";
  bool logout = false;
  @override
  void initState() {
    initUser();
    super.initState();
  }

  initUser() async {
    this.uid = await getStorage("uid");
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: new CupertinoNavigationBar(
        actionsForegroundColor: Colors.white,
        backgroundColor: widget.mainColor,
        middle: new Text(
          "随行设置",
          style: new TextStyle(
            color: Colors.white,
            fontWeight: FontWeight.normal,
          ),
        ),
      ),
      body: new Container(
        child: new ListView(
          children: <Widget>[
            new ListTile(
              onTap: () {
                Navigator.of(context).push(
                  new CupertinoPageRoute(builder: (context) {
                    return new SafePage(widget.mainColor);
                    //return new PasswordPage(mainColor);
                  }),
                );
              },
              leading: new ImageIcon(AssetImage("images/safe.png")),
              title: new Text("安全设置"),
              trailing: new Icon(Icons.chevron_right),
            ),
            new Divider(
              height: 1.0,
            ),
            new ListTile(
              onTap: () {
                Navigator.of(context).push(
                  new CupertinoPageRoute(builder: (context) {
                    return new FeedbackPage(widget.mainColor);
                  }),
                );
              },
              leading: new ImageIcon(AssetImage("images/feedback.png")),
              title: new Text("反馈建议"),
              trailing: new Icon(Icons.chevron_right),
            ),
            new Divider(
              height: 1.0,
            ),
            new ListTile(
              onTap: () {
                Navigator.of(context).push(
                  new CupertinoPageRoute(builder: (context) {
                    return new AboutPage(widget.mainColor);
                    //return new PasswordPage(mainColor);
                  }),
                );
              },
              leading: new Icon(Icons.info),
              title: new Text("关于随行"),
              trailing: new Icon(Icons.chevron_right),
            ),
            new Divider(
              height: 1.0,
            ),
          ],
        ),
      ),
    );
  }
}
